package com.piotrs10.bsk.model.permissions;

import java.io.Serializable;

public class Uzytkownik implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8662064017746603383L;

	private String login;
	private boolean isAdministrator;

	public Uzytkownik(String login, boolean isAdministrator) {
		super();
		this.login = login;
		this.isAdministrator = isAdministrator;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public boolean isAdministrator() {
		return isAdministrator;
	}

	public void setAdministrator(boolean isAdministrator) {
		this.isAdministrator = isAdministrator;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (isAdministrator ? 1231 : 1237);
		result = prime * result + ((login == null) ? 0 : login.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Uzytkownik other = (Uzytkownik) obj;
		if (isAdministrator != other.isAdministrator)
			return false;
		if (login == null) {
			if (other.login != null)
				return false;
		} else if (!login.equals(other.login))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return this.login;
	}
	
	

}
